<?php

namespace App\Http\Middleware;

use Closure;

class CheckUser
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
	public function handle($request, Closure $next)
	{
		//$request->session()->put("laravel_session","asdasasdasd");
		$check = $this->checkUserLogin($request);
		if($check){
			return $next($request);
		}else{
			return redirect('/login');
		}
	}
	
	//检查用户是否登录
	protected function checkUserLogin($request){
		if($request->cookie('wms_auth')){
			return true;
		}
		return false;
	}
}
